﻿@namespace BootstrapBlazor.Components

<div class="navbar navbar-expand d-none d-md-flex">
    <ul class="navbar-nav">
        @foreach (var menu in Items)
        {
            @if (menu.Items.Any())
            {
                <li class="@GetClassString("nav-item dropdown", menu.IsActive)">
                    <a class="@GetClassString("nav-link dropdown-toggle", menu.IsActive)" data-toggle="dropdown" role="button" href="#">
                        @if (!string.IsNullOrEmpty(menu.Icon))
                        {
                            <i class="@menu.Icon"></i>
                        }
                        <span>@menu.Text</span>
                        @if (menu.Component != null)
                        {
                            @menu.Component.Render()
                        }
                    </a>
                    <div class="dropdown-menu">
                        <div class="dropdown-menu-arrow"></div>
                        @foreach (var item in menu.Items)
                        {
                            @if (item.Items.Any())
                            {
                                @RenderDropdownItem(item)
                            }
                            else
                            {
                                <MenuLink Item="@item" DisableNavigation="@DisableNavigation" class="dropdown-item" OnClick="@OnClickMenuItem" />
                            }
                        }
                    </div>
                </li>
            }
            else
            {
                <li class="@GetClassString("nav-item", menu.IsActive)">
                    <MenuLink Item="@menu" DisableNavigation="@DisableNavigation" class="nav-link" OnClick="@OnClickMenuItem" />
                </li>
            }
        }
    </ul>
</div>
